// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// Author: Markus Gutschke

#ifndef OUTPUT_PRINT_JOB_H__
#define OUTPUT_PRINT_JOB_H__

#include "json.h"
#include "oauth2.h"


enum ColorSpace {
  CLSP_BLACK = 3, CLSP_CMYK = 6, CLSP_SGRAY = 18, CLSP_SRGB = 19,
  CLSP_ADOBE_RGB = 20, CLSP_VENDOR48 = 48, CLSP_VENDOR49 = 49,
  CLSP_VENDOR50 = 50, CLSP_VENDOR51 = 51, CLSP_VENDOR52 = 52,
  CLSP_VENDOR53 = 53, CLSP_VENDOR54 = 54, CLSP_VENDOR55 = 55,
  CLSP_VENDOR56 = 56, CLSP_VENDOR57 = 57, CLSP_VENDOR58 = 58,
  CLSP_VENDOR59 = 59, CLSP_VENDOR60 = 60, CLSP_VENDOR61 = 61,
  CLSP_VENDOR62 = 62
};

struct PrintParams {
  int             hRes, vRes;
  int             leadingEdge;
  int             width, height;
  int             bitsPerColor, bitsPerPixel, bytesPerLine;
  enum ColorSpace colorSpace;
  int             numColors;
};

struct PrinterBackend {
  void (*destructor)(struct PrinterBackend *backend);
  void *(* const startJob)(struct PrinterBackend *backend,
                           const struct PrintParams *params);
  int  (* const newParams)(void *arg, const struct PrintParams *params);
  int  (* const startPage)(void *arg);
  int  (* const sendData)(void *arg, const char *data, size_t sz);
  int  (* const finishPage)(void *arg);
  int  (* const finishJob)(void *arg);
};

void outputPrintJob(struct OAuth2 *oauth2, struct JSON *job,
                    struct PrinterBackend *backend);
void destroyPrinterBackend(struct PrinterBackend *backend);
void deletePrinterBackend(struct PrinterBackend *backend);

#endif  // OUTPUT_PRINT_JOB_H__
